import { IResult } from '@/interface/common'
import request from '@/units/request'
import { AxiosPromise } from 'axios'
import { IAddCreditQuery, IGetQueueListValidate, IGetReturnVisitListQuery, IQueueItem, IReservationListQuery, IReservationPayAndRegisterQuery, IReservationPayAndRegisterResponse, IReservationSignQuery, IReturnVisitListData, IReturnVisitValidate, ISysPay } from '../interface/reservation'

export const GetQueueList = (data: IGetQueueListValidate) : AxiosPromise<IResult<IQueueItem[]>> =>
  request({
    url: '/api/queue/GetQueueList',
    method: 'post',
    data
  })

export const GetReservationList = (data: IReservationListQuery) : AxiosPromise<IResult<string>> =>
  request({
    url: '/api/Clinic/Query',
    method: 'post',
    data
  })

export const ReservationSign = (data: IReservationSignQuery) : AxiosPromise<IResult<string>> =>
  request({
    url: '/api/Clinic/Sign',
    method: 'post',
    data
  })

export const ReservationPayAndRegister = (data: IReservationPayAndRegisterQuery) : AxiosPromise<IResult<IReservationPayAndRegisterResponse>> =>
  request({
    url: '/api/Clinic/Registered',
    method: 'post',
    data
  })

export const GetQrCode = (data: IAddCreditQuery) : AxiosPromise<IResult<ISysPay>> =>
  request({
    url: '/api/SysPay/GetQrCode',
    method: 'post',
    data
  })

export const GetPayResult = (id:string) : AxiosPromise<IResult<ISysPay>> =>
  request({
    url: `/api/SysPay/GetPayResult/${id}`,
    method: 'get'
  })

export const GetReturnVisitList = (data: IGetReturnVisitListQuery) : AxiosPromise<IResult<IReturnVisitListData[]>> =>
  request({
    url: '/Api/Clinic/ReturnVisitList',
    method: 'post',
    data
  })

export const ReturnVisit = (data: IReturnVisitValidate) : AxiosPromise<IResult<any>> =>
  request({
    url: '/Api/Clinic/ReturnVisit',
    method: 'post',
    data
  })
